package function;

import model.Author;
import model.GetAuthors;

import java.util.List;
import java.util.Optional;

public class Find {
    public static void main(String[] args) {
        List<Author> authors = GetAuthors.getAuthors();
        Optional<Author> any = authors.stream()
                .filter(author -> author.getAge()>18)
                .findAny();

        any.ifPresent(author -> System.out.println(author.getName()+" "+author.getAge()));
    }
}
